package com.yes.yll;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class APPRef {
    public static void main(String[] args) throws Exception{
        Class<?> a = Class.forName("com.yes.yll.Human");
        Object o = a.newInstance();

        Field name = a.getDeclaredField("name");//找name字段
        name.setAccessible(true);
        name.set(o,"cuize");

        Method getName = a.getMethod("getName");
        Object result = getName.invoke(o);
        System.out.println(result);

    }
}
